//头部顶部
$('.firstTopInner ul .firstToplast').hover(function(){
	$('.firstTopInner ul .firstToplast div').slideDown()
	 $('.firstTopInner ul .firstToplast').css('background-color','#FFFFFF')
	 $('.firstTopInner ul .firstToplast img').attr('src','images/购物.png')
	  $('.firstTopInner ul .firstToplast span').css('color','#FF6700')
},function(){
	$('.firstTopInner ul .firstToplast div').slideUp()
	 $('.firstTopInner ul .firstToplast').css('background-color','#424242')
	 $('.firstTopInner ul .firstToplast img').attr('src','images/购物车.png')
	   $('.firstTopInner ul .firstToplast span').css('color','#b0b0b0')
})
//第二部分
$('.secTop .secdiv .secbutton1').hover(function(){
	$('.secTop .secdiv .secbutton1 img').attr('src','images/搜索(3).png')
	$('.secTop .secdiv .secbutton1').css('background-color','#ff6700')
},function(){
	$('.secTop .secdiv .secbutton1 img').attr('src','images/搜索(2).png')
	$('.secTop .secdiv .secbutton1').css('background-color','white')
})

$('.secTop .secdiv input').on('click',function(event){
	event.stopPropagation();
	$('.secTop .secdiv .secbutton').css('display','none')
	$('.secTop .secdown').css('display','block')
	$('.secTop .secdiv').css('border-color','#ff6700')
	$('.secTop .secdiv input').css('border-right-color','#ff6700')
})
$('body').click(function(){
	$('.secTop .secdown').css('display','none')
	$('.secTop .secdiv .secbutton').css('display','block')
	$('.secTop .secdiv').css('border-color','#e0e0e0')
	$('.secTop .secdiv input').css('border-right-color','#e0e0e0')
})
//---------------------------------------------------------疑问

$(".secTop ul li").hover(function(){
	$('.secup').stop().slideToggle()
});
$(".secup").hover(function(){
	$('.secup').stop().slideToggle()
});
//----
$('.secTop ul .secxiaomi').mouseover(function(){
	$('.secup .secupxiaomi').css('display','block').siblings().css('display','none')
})
$('.secTop ul .sechongmi').mouseover(function(){
	$('.secup .secuphongmi').css('display','block').siblings().css('display','none')
})
$('.secTop ul .secpingban').mouseover(function(){
	$('.secup .secuppingban').css('display','block').siblings().css('display','none')
})
$('.secTop ul .secdianshi').mouseover(function(){
	$('.secup .secupdianshi').css('display','block').siblings().css('display','none')
})
$('.secTop ul .seczhineng').mouseover(function(){
	$('.secup .secupzhineng').css('display','block').siblings().css('display','none')
})
$('.secTop ul .sechezi').mouseover(function(){
	$('.secup .secuphezi').css('display','block').siblings().css('display','none')
})
$('.secTop ul .secluyouqi').mouseover(function(){
	$('.secup .secupluyouqi').css('display','block').siblings().css('display','none')
})
//------轮播
$('.home-hero-slider img').first().css('z-index','3');
$('.home-hero-dian').css('z-index','5');
$('.home-hero-dian ul li:nth-child(1)').addClass('check');
var currentIndex = 0
var totalNum = $('.home-hero-slider>img').length
function autoScroll(){
	if (currentIndex>=totalNum) {
		currentIndex = 0
	}
	$('.home-hero-slider img').eq(currentIndex).fadeIn().siblings().fadeOut();
	$('.home-hero-dian ul li').eq(currentIndex).addClass('check').siblings().removeClass('check');
	
	currentIndex++
}
var timer = setInterval(autoScroll,2000);
$('.home-hero-dian ul li').hover(function () {
	clearInterval(timer)
	var pointIndex = $(this).index()
	$('.home-hero-slider img').eq(pointIndex).fadeIn().siblings().fadeOut();
	$('.home-hero-dian ul li').eq(pointIndex).addClass('check').siblings().removeClass('check');
	
},function () {

	currentIndex = $(this).index() + 1
	timer = setInterval(autoScroll,2000)
});
$('.home-hero-left').on('click',function(){
	clearInterval(timer)
	currentIndex--
	if (currentIndex<0) {
		currentIndex = totalNum-1
	}
	$('.home-hero-slider img').eq(currentIndex-1).fadeIn().siblings().fadeOut();
	$('.home-hero-dian ul li').eq(currentIndex-1).addClass('check').siblings().removeClass('check');
})
$('.home-hero-left').hover(function(){
	clearInterval(timer)
},function(){
	timer = setInterval(autoScroll,2000)
	currentIndex = $(this).index() + 1
})
//$('.home-hero-left').mouseleave(function(){
//	timer = setInterval(autoScroll,2000)
//	currentIndex = $(this).index() + 1
//})
$('.home-hero-right').on('click',function(){
	clearInterval(timer)
	currentIndex++
	if (currentIndex>=totalNum) {
		currentIndex = 0
	}
	$('.home-hero-slider img').eq(currentIndex+1).fadeIn().siblings().fadeOut();
	$('.home-hero-dian ul li').eq(currentIndex+1).addClass('check').siblings().removeClass('check');
})
$('.home-hero-right').hover(function(){
	clearInterval(timer)
},function(){
		timer = setInterval(autoScroll,2000)
	currentIndex = $(this).index() + 1
})
//$('.home-hero-right').mouseleave(function(){
//	timer = setInterval(autoScroll,2000)
//	currentIndex = $(this).index() + 1
//})
//-------------

$(".home-hero ul li").hover(function(){
	$('.home-hero-chanpin').stop().toggle()
});
$(".home-hero-chanpin").hover(function(){
	$('.home-hero-chanpin').stop().toggle()
});
$('.home-hero ul li:nth-child(1)').mousemove(function(){
	$('.home-hero-chanpin .home-phone').show().siblings().hide()
	$('.home-hero ul li:nth-child(1)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(2)').mousemove(function(){
	$('.home-hero-chanpin .home-bijiben').show().siblings().hide()
	$('.home-hero ul li:nth-child(2)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(3)').mousemove(function(){
	$('.home-hero-chanpin .home-dianshi').show().siblings().hide()
	$('.home-hero ul li:nth-child(3)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(4)').mousemove(function(){
	$('.home-hero-chanpin .home-luyou').show().siblings().hide()
	$('.home-hero ul li:nth-child(4)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(5)').mousemove(function(){
	$('.home-hero-chanpin .home-yidongdianyuan').show().siblings().hide()
	$('.home-hero ul li:nth-child(5)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(6)').mousemove(function(){
	$('.home-hero-chanpin .home-erji').show().siblings().hide()
	$('.home-hero ul li:nth-child(6)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(7)').mousemove(function(){
	$('.home-hero-chanpin .home-tiemo').show().siblings().hide()
	$('.home-hero ul li:nth-child(7)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(8)').mousemove(function(){
	$('.home-hero-chanpin .home-xiancai').show().siblings().hide()
	$('.home-hero ul li:nth-child(8)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(9)').mousemove(function(){
	$('.home-hero-chanpin .home-xiangbao').show().siblings().hide()
	$('.home-hero ul li:nth-child(9)').addClass('home-check').siblings().removeClass('home-check')
})
$('.home-hero ul li:nth-child(10)').mousemove(function(){
	$('.home-hero-chanpin .home-mitu').show().siblings().hide()
	$('.home-hero ul li:nth-child(10)').addClass('home-check').siblings().removeClass('home-check')
})

var span4 = $('.home-hero-sub .span4 ul:nth-of-type(1) li').length;
$('.home-hero-sub ul:nth-of-type(1) li').hover(function(){
	$('.home-hero-sub ul:nth-of-type(1) li img').eq(0).attr('src','images/选购手机(1).png')
	$('.home-hero-sub ul:nth-of-type(1) li img').eq(1).attr('src','images/礼物(1).png')
	$('.home-hero-sub ul:nth-of-type(1) li img').eq(2).attr('src','images/循环(1).png')
	
	$('.home-hero-sub ul:nth-of-type(1) li p').eq($(this).index()).css('color','white')
},function(){
	$('.home-hero-sub ul:nth-of-type(1) li img').eq(0).attr('src','images/选购手机.png')
	$('.home-hero-sub ul:nth-of-type(1) li img').eq(1).attr('src','images/礼物.png')
	$('.home-hero-sub ul:nth-of-type(1) li img').eq(2).attr('src','images/循环.png')
	$('.home-hero-sub ul:nth-of-type(1) li p').eq($(this).index()).css('color','#cfcdcb')
})
//----------
var current = 1;
function autohuadong(){
	var num = current%2;
	if (num != 0) {
		$('.box-bd .box-bd-inner ul').animate({'marginLeft':'-1226px'},1000);
		$('.box-hd .box-hd-left').css('color','#b0b0b5').siblings().css('color','#e2e0e0')
		
	} else{
		$('.box-bd .box-bd-inner ul').animate({'marginLeft':'0'},1000);
		$('.box-hd .box-hd-right').css('color','#b0b0b5').siblings().css('color','#e2e0e0')
	}
	current++;
}
var auto = setInterval(autohuadong,3000);
$('.box-hd .box-hd-left').click(function(){
	$('.box-bd .box-bd-inner ul').animate({'marginLeft':'-1226px'},1000)
})
$('.box-hd .box-hd-right').click(function(){
	$('.box-bd .box-bd-inner ul').animate({'marginLeft':'0'},1000)
})
$('.box-hd .box-hd-button').hover(function(){
	clearInterval(auto)
},function(){
	 auto = setInterval(autohuadong,4000);
})
$('.box-hd .box-hd-left').hover(function(){
		$('.box-hd .box-hd-left').css('color','#FF6700').siblings().css('color','#e2e0e0')
	},function(){
		$('.box-hd .box-hd-left').css('color','#b0b0b5')
	})
$('.box-hd .box-hd-right').hover(function(){
		$('.box-hd .box-hd-right').css('color','#FF6700').siblings().css('color','#e2e0e0')
	},function(){
		$('.box-hd .box-hd-right').css('color','#b0b0b5')
	})

//-----------------------------
$('.page-num1 .page-num1-head>div').hover(function(){
	$('.page-num1 .page-num1-head>div span').css('color','#FF6700');
	$('.page-num1 .page-num1-head>div div').css('background-color','#ff6700');
},function(){
	$('.page-num1 .page-num1-head>div span').css('color','#424242');
	$('.page-num1 .page-num1-head>div div').css('background-color','#B0B0B0');
})

//----------
$('.page-num2 .page-num2-hd div ul li').mouseenter(function(){
	$(this).find('a').css({
		'color':'#ff6700',
		'borderBottom':'2px solid #ff6700'
	}).parent().siblings().find('a').css({
		'color':'#333333',
		'borderBottom':'none'
	})
})
$('.page-num2 .page-num2-bd div ul li').hover(function(){
	$(this).find('div').slideDown(200)
	console.log($(this).index())
	
},function(){
	$('.page-num2 .page-num2-bd div ul li .page-hidden').slideUp(100)
})
$('.page-num2 .page-num2-hd div ul li:nth-of-type(1) a').addClass('page2-check')
$('.page-num2 .page-num2-bd .page-num2-right:nth-of-type(2)').css('z-index','2')
$('.page-num2 .page-num2-hd div ul li:nth-of-type(1)').mousemove(function(){
	$('.page-num2 .page-num2-bd .page-num2-right:nth-of-type(2)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num2 .page-num2-hd div ul li:nth-of-type(2)').mousemove(function(){
	$('.page-num2 .page-num2-bd .page-num2-right:nth-of-type(3)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num2 .page-num2-hd div ul li:nth-of-type(3)').mousemove(function(){
	$('.page-num2 .page-num2-bd .page-num2-right:nth-of-type(4)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num2 .page-num2-hd div ul li:nth-of-type(4)').mousemove(function(){
	$('.page-num2 .page-num2-bd .page-num2-right:nth-of-type(5)').css('z-index','2').siblings().css('z-index','1')
})
//-------------------------------------------
$('.page-num3 .page-num2-hd div ul li').mouseenter(function(){
	$(this).find('a').css({
		'color':'#ff6700',
		'borderBottom':'2px solid #ff6700'
	}).parent().siblings().find('a').css({
		'color':'#333333',
		'borderBottom':'none'
	})
})
$('.page-num3 .page-num2-bd div ul li').hover(function(){
	$(this).find('div').slideDown(200)
	console.log($(this).index())
	
},function(){
	$('.page-num3 .page-num2-bd div ul li .page-hidden').slideUp(100)
})
$('.page-num3 .page-num2-hd div ul li:nth-of-type(1) a').addClass('page2-check')
$('.page-num3 .page-num2-bd .page-num2-right:nth-of-type(2)').css('z-index','2')
$('.page-num3 .page-num2-hd div ul li:nth-of-type(1)').mousemove(function(){
	$('.page-num3 .page-num2-bd .page-num2-right:nth-of-type(2)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num3 .page-num2-hd div ul li:nth-of-type(2)').mousemove(function(){
	$('.page-num3 .page-num2-bd .page-num2-right:nth-of-type(3)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num3 .page-num2-hd div ul li:nth-of-type(3)').mousemove(function(){
	$('.page-num3 .page-num2-bd .page-num2-right:nth-of-type(4)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num3 .page-num2-hd div ul li:nth-of-type(4)').mousemove(function(){
	$('.page-num3 .page-num2-bd .page-num2-right:nth-of-type(5)').css('z-index','2').siblings().css('z-index','1')
})
//------------------------------------------------
$('.page-num4 .page-num2-hd div ul li').mouseenter(function(){
	$(this).find('a').css({
		'color':'#ff6700',
		'borderBottom':'2px solid #ff6700'
	}).parent().siblings().find('a').css({
		'color':'#333333',
		'borderBottom':'none'
	})
})
$('.page-num4 .page-num2-bd div ul li').hover(function(){
	$(this).find('div').slideDown(200)
	console.log($(this).index())
	
},function(){
	$('.page-num4 .page-num2-bd div ul li .page-hidden').slideUp(100)
})
$('.page-num4 .page-num2-hd div ul li:nth-of-type(1) a').addClass('page2-check')
$('.page-num4 .page-num2-bd .page-num2-right:nth-of-type(2)').css('z-index','2')
$('.page-num4 .page-num2-hd div ul li:nth-of-type(1)').mousemove(function(){
	$('.page-num4 .page-num2-bd .page-num2-right:nth-of-type(2)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num4 .page-num2-hd div ul li:nth-of-type(2)').mousemove(function(){
	$('.page-num4 .page-num2-bd .page-num2-right:nth-of-type(3)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num4 .page-num2-hd div ul li:nth-of-type(3)').mousemove(function(){
	$('.page-num4 .page-num2-bd .page-num2-right:nth-of-type(4)').css('z-index','2').siblings().css('z-index','1')
})
$('.page-num4 .page-num2-hd div ul li:nth-of-type(4)').mousemove(function(){
	$('.page-num4 .page-num2-bd .page-num2-right:nth-of-type(5)').css('z-index','2').siblings().css('z-index','1')
})
//---------------------------------------------------------------
var curren = 1;
function autohuadon(){
	var num = curren%2;
	if (num != 0) {
		$('.home-star .box-bd .box-bd-inner ul').animate({'marginLeft':'-1226px'},1000);
		$('.home-star .box-hd .box-hd-left').css('color','#b0b0b5').siblings().css('color','#e2e0e0')
		
	} else{
		$('.home-star .box-bd .box-bd-inner ul').animate({'marginLeft':'0'},1000);
		$('.home-star .box-hd .box-hd-right').css('color','#b0b0b5').siblings().css('color','#e2e0e0')
	}
	curren++;
}
var aut = setInterval(autohuadon,3000);
$('.home-star .box-hd .box-hd-left').click(function(){
	$('.home-star .box-bd .box-bd-inner ul').animate({'marginLeft':'-1226px'},1000)
})
$('.home-star .box-hd .box-hd-right').click(function(){
	$('.home-star .box-bd .box-bd-inner ul').animate({'marginLeft':'0'},1000)
})
$('.home-star .box-hd .box-hd-button').hover(function(){
	clearInterval(aut)
},function(){
	 aut = setInterval(autohuadon,5000);
})
$('.home-star .box-hd .box-hd-left').hover(function(){
		$('.box-hd .box-hd-left').css('color','#FF6700').siblings().css('color','#e2e0e0')
	},function(){
		$('.box-hd .box-hd-left').css('color','#b0b0b5')
	})
$('.home-star .box-hd .box-hd-right').hover(function(){
		$('.box-hd .box-hd-right').css('color','#FF6700').siblings().css('color','#e2e0e0')
	},function(){
		$('.box-hd .box-hd-right').css('color','#b0b0b5')
	});
//----------------------------------------------------------------------


var left =0;
$('.page-content .page-book .page-content-button ul li').eq(0).addClass('check-color');
$('.page-content .page-book .page-content-right').click(function(){
	var index=Math.abs(left/296)+1;
	console.log(index)
	$('.page-content .page-book .page-content-button ul li').eq(index).addClass('check-color').siblings().removeClass('check-color');
	if(left <-296){
		return;
	}
	left=left - 296;
	$('.page-content .page-content-bd .page-book .page-content-scroll ul').animate({
		'left':left
	},500)
})


$('.page-content .page-book .page-content-left').click(function(){
	var index1 = Math.abs(left/296) - 1;
	

	if(index1 <0){
		index1 = 0  
	}
	
	console.log(index1)
	
	$('.page-content .page-book .page-content-button ul li').eq(index1).addClass('check-color').siblings().removeClass('check-color');
	if (left > -296) {
		return;
	} 
	left = left +296;
	$('.page-content  .page-content-bd .page-book .page-content-scroll ul').animate({
		'left':left
	},500)
})
$('.page-content .page-book .page-content-button ul li').click(function(){
	$(this).addClass('check-color').siblings().removeClass('check-color');
	left = -(296 * $(this).index());
	$('.page-content .page-book .page-content-bd .page-content-scroll ul').animate({
		'left': left
	}, 500);
	
})
//-----------------------------------------
//主题
$('.page-content .page-zhuti .page-content-button ul li').eq(0).addClass('check-color');
$('.page-content .page-zhuti .page-content-right').click(function(){
	var index=Math.abs(left/296)+1;
	console.log(index)
	$('.page-content .page-zhuti .page-content-button ul li').eq(index).addClass('check-color').siblings().removeClass('check-color');
	if(left <-592){
		return;
	}
	left=left - 296;
	$('.page-content  .page-content-bd .page-zhuti .page-content-scroll ul').animate({
		'left':left
	},500)
})


$('.page-content .page-zhuti .page-content-left').click(function(){
	var index1 = Math.abs(left/296) - 1;
	

	if(index1 <0){
		index1 = 0  
	}
	
	console.log(index1)
	
	$('.page-content .page-zhuti .page-content-button ul li').eq(index1).addClass('check-color').siblings().removeClass('check-color');
	if (left > -296) {
		return;
	} 
	left = left +296;
	$('.page-content .page-content-bd .page-zhuti .page-content-scroll ul').animate({
		'left':left
	},500)
})
$('.page-content .page-zhuti .page-content-button ul li').click(function(){
	$(this).addClass('check-color').siblings().removeClass('check-color');
	left = -(296 * $(this).index());
	$('.page-content .page-zhuti .page-content-bd .page-content-scroll ul').animate({
		'left': left
	}, 500);
	
})
//游戏
$('.page-content .page-game .page-content-button ul li').eq(0).addClass('check-color');
$('.page-content .page-game .page-content-right').click(function(){
	var index=Math.abs(left/296)+1;
	console.log(index)
	$('.page-content .page-game .page-content-button ul li').eq(index).addClass('check-color').siblings().removeClass('check-color');
	if(left <-592){
		return;
	}
	left=left - 296;
	$('.page-content  .page-content-bd .page-game .page-content-scroll ul').animate({
		'left':left
	},500)
})


$('.page-content .page-game .page-content-left').click(function(){
	var index1 = Math.abs(left/296) - 1;
	

	if(index1 <0){
		index1 = 0  
	}
	
	console.log(index1)
	
	$('.page-content .page-game .page-content-button ul li').eq(index1).addClass('check-color').siblings().removeClass('check-color');
	if (left > -296) {
		return;
	} 
	left = left +296;
	$('.page-content .page-content-bd .page-game .page-content-scroll ul').animate({
		'left':left
	},500)
})
$('.page-content .page-game .page-content-button ul li').click(function(){
	$(this).addClass('check-color').siblings().removeClass('check-color');
	left = -(296 * $(this).index());
	$('.page-content .page-game .page-content-bd .page-content-scroll ul').animate({
		'left': left
	}, 500);
	
})
//应用
$('.page-content .page-app .page-content-button ul li').eq(0).addClass('check-color');
$('.page-content .page-app .page-content-right').click(function(){
	var index=Math.abs(left/296)+1;
	console.log(index)
	$('.page-content .page-app .page-content-button ul li').eq(index).addClass('check-color').siblings().removeClass('check-color');
	if(left <-592){
		return;
	}
	left=left - 296;
	$('.page-content  .page-content-bd .page-app .page-content-scroll ul').animate({
		'left':left
	},500)
})


$('.page-content .page-app .page-content-left').click(function(){
	var index1 = Math.abs(left/296) - 1;
	

	if(index1 <0){
		index1 = 0  
	}
	
	console.log(index1)
	
	$('.page-content .page-app .page-content-button ul li').eq(index1).addClass('check-color').siblings().removeClass('check-color');
	if (left > -296) {
		return;
	} 
	left = left +296;
	$('.page-content .page-content-bd .page-app .page-content-scroll ul').animate({
		'left':left
	},500)
})
$('.page-content .page-app .page-content-button ul li').click(function(){
	$(this).addClass('check-color').siblings().removeClass('check-color');
	left = -(296 * $(this).index());
	$('.page-content .page-app .page-content-bd .page-content-scroll ul').animate({
		'left': left
	}, 500);
	
})
//
$('.page-content>ul>li').hover(function(){
	$(this).find('.page-content-left').show()
	$(this).find('.page-content-right').show()
},function(){
	$('.page-content>ul>li .page-content-left').hide()
	$('.page-content>ul>li .page-content-right').hide()
})
